package com.itheima.mapper;

import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDao {
    @Select("select * from t_setmeal")
    List<Setmeal> getSetmeal();
    @Select("select * from t_setmeal where id=#{id}")
    Setmeal findById(Long id);
    @Select("SELECT t_checkgroup.* FROM t_checkgroup join t_setmeal_checkgroup on t_checkgroup.id=t_setmeal_checkgroup.checkgroup_id join t_setmeal on t_setmeal.id=t_setmeal_checkgroup.setmeal_id where t_setmeal.id=#{id}")
    List<CheckGroup> findByIdcheckGroups(Long id);
    @Select("SELECT t_checkitem.* FROM t_checkitem join t_checkgroup_checkitem on t_checkitem.id=t_checkgroup_checkitem.checkitem_id join t_checkgroup on t_checkgroup.id=t_checkgroup_checkitem.checkgroup_id where t_checkgroup.id=#{checkGroupId}")
    List<CheckItem> findByIdcheckItems(Integer checkGroupId);
}
